import React, { Component } from 'react';
import { connect } from 'dva';
// import { } from 'antd';
import { withRouter } from 'umi';
import PropTypes from 'prop-types';
import AdModal from '@/components/AdModal';
import { allDispatchType, codes } from './utils';
import OcrPaperDetailInfo from './OcrPaperDetailInfo';

@withRouter
export default class OcrPaperListInfo extends Component {
  static PropTypes = {
    showUpload: PropTypes.bool,
    visible: PropTypes.bool,
  }
  static defaultProps = {
    showUpload: true,
    visible: true,
  }
  constructor(props) {
    super(props);
    this.state = {
    };
  }
  componentDidMount() { }
  handleStateChange = (options = []) => {
    options.map(item => {
      this.setState(item);
    });
  };
  render() {
    const { papersType } = this.state;
    const { addMode, setInfoModal, papersId, ocrId, ocrType, loading, ocrDetails, visible, showUpload } = this.props;
    return (
      <div>
        <AdModal
          visible={visible}
          title={!papersId || !ocrId ? '新增证件' : '证件信息'}
          onOk={this.handleOk}
          onCancel={() => {
            setInfoModal()
          }}
          width="600px"
          bodyStyle={{
            height: 'calc(100vh - 100px)',
            overflowY: 'auto',
            padding: '12px 12px 0 12px',
            // background: '#F0F2F5',
          }}
          footer={null}
        >
          <OcrPaperDetailInfo
            setInfoModal={setInfoModal}
            setStateChange={this.handleStateChange}
            setLastStateChange={this.handleStateChange} //为了统一设置paperType
            papersId={papersId} papersType={papersType}
            ocrId={ocrId} ocrType={ocrType}
            showUpload={showUpload}
            addMode={addMode}
          />
        </AdModal>
      </div>
    );
  }
}
